package com.tevintao.marketingsystem.task;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.tevintao.marketingsystem.log.LogManager;
import com.tevintao.marketingsystem.xposted.WxTaskManger;


public class GetNickNameTaskProcess extends SetTaskExtra {
    private static GetNickNameTaskProcess ourInstance = new GetNickNameTaskProcess();

    public static GetNickNameTaskProcess getInstance() {
        return ourInstance;
    }

    private GetNickNameTaskProcess() {
    }

    @SuppressWarnings("ResourceType")
    @Override
    public boolean processView(String contextName, View v) {

        if (WxUiViewConfig.MAIN_LAUNCH.equals(contextName)) {
            boolean inContact = WxUiViewConfig.inTab(v, WxUiViewConfig.TAB_ME);
            LogManager.getInstance().logInfo("intab = " + inContact);
            if (inContact) {
                LogManager.getInstance().logInfo("当前位于我按钮所在的列表");
//                WxUiViewConfig.printViewGroup((ViewGroup) v);
                View nickNameView = v.findViewById(2131624143);

                if (null != nickNameView && nickNameView instanceof TextView) {
                    if (nickNameView instanceof TextView) {
                        TextView textView = (TextView) nickNameView;
//                        LogManager.getInstance().logInfo("~~~~~~~~~~~~~~~~~~~"+textView.getText().toString());
                        taskError(v.getContext(), WxTaskManger.TASK_SATE_SUCCESS, textView.getText().toString());
                    }
                }
            }
        }

        return false;
    }
}
